home *** CD-ROM | disk | FTP | other *** search
- /*
- File: InfoUtil.h
-
- Contains: function declarations Info getters & setters
-
- Owned by: Nick Pilch
-
- Copyright: © 1993 - 1996 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <11> 10/10/96 RA 1343748: Pass around thePartSU so we can
- use a preferred editor string for NoPart.
- <10> 10/7/96 RA 1343814: Pass around thePartSU so we can
- use a preferred kind string for NoPart
- <9> 9/13/96 EL 1385235: Kind Menu should dispaly every
- stored kind as active.
- <8> 7/8/96 EL 1364853: Add ODSetPartNameReturnError to do
- set part name but get error code back.
- <7> 6/12/96 RA 1301627 : ODGetIconFamily now looks in all
- volume DTDB's ; added StVolumeLoop util
- class.
- <6> 6/5/96 EL 1355529: Move InitKindsPopUp from Info.cpp
- to here for sharing, add parameters for
- AddTypesToMenu.
- <5> 6/4/96 EL 1279544: Move GetTypeListItem from
- TransDlg.cpp to InfoUtil.cpp.
- <4> 5/31/96 jpa T10012: Added ODGetIconFilePlatformCreator.
- <3> 5/24/96 jpa 1.1MRD: pragma internal eliminates NOPs.
- <2> .04.1996 NP 1330731: Don't use stationery property
- anymore.
-
- To Do:
- In Progress:
-
- */
-
- #ifndef _INFOUTIL_
- #define _INFOUTIL_
-
- #ifndef _ODTYPES_
- #include <ODTypes.h>
- #endif
-
- #ifndef __CONTROLS__
- #include <Controls.h>
- #endif
-
- #ifndef SOM_ODWindowState_xh
- #include <WinStat.xh>
- #endif
-
- #ifndef SOM_ODNameSpaceManager_xh
- #include "NmSpcMg.xh"
- #endif
-
- #ifndef _ORDCOLL_
- #include "OrdColl.h"
- #endif
-
- //==============================================================================
- // Theory of Operation
- //==============================================================================
-
- //==============================================================================
- // Constants
- //==============================================================================
-
- //==============================================================================
- // Scalar Types
- //==============================================================================
-
- //==============================================================================
- // Classes used by this interface
- //==============================================================================
-
- class ODFrame;
- class ODStorageUnit;
- class ODPart;
- class ODPersistentObject;
- class ODTypeList;
- class EditorSet;
- class ODSession;
- class PlatformFile;
-
- //==============================================================================
- // Info functions
- //==============================================================================
-
- #ifdef _OD_IMPL_SHARE_UTILS_
- #pragma import on
- #elif defined(PRAGMA_INTERNAL_SUPPORTED)
- #pragma internal on
- #endif
-
- extern "C" {
-
-
-
- //-------------------------------------------------------------------------------------
- // Persistent Object Property getters and setters
- // Note:
- // all Getters expect you to pass in a buffer to be filled
- // or kODNULL which causes it to create one for you
- // all Setters do NOT consume what you pass in, so it is safe to pass in
- // a reference to your internal structures. They are only accessed for the duration
- // of the Setter API call.
- // These conventions were adopted to reduce memory allocation/deallocation.
- //-------------------------------------------------------------------------------------
-
- ODULong ODGetCreationDate(Environment* ev,
- ODStorageUnit* su);
- void ODSetCreationDate(Environment* ev,
- ODStorageUnit* su,
- ODTime dateTime);
-
- ODULong ODGetModificationDate(Environment* ev,
- ODStorageUnit* su);
- void ODSetModificationDate(Environment* ev,
- ODStorageUnit* su,
- ODTime dateTime);
-
- ODIText* ODGetModifiedBy(Environment* ev,
- ODStorageUnit* su,ODIText* userName);
- void ODSetModifiedBy(Environment* ev,
- ODStorageUnit* su, ODIText* userName);
-
-
- ODStorageUnit* ODGetSUFromPstObj(Environment* ev, ODPersistentObject* pstobj);
-
- ODIText* ODGetPOComments(Environment* ev, ODPart* part, ODIText* comments);
- void ODSetPOComments(Environment* ev, ODPart* part, ODIText* comments);
-
- ODIconFamily ODGetPOIconFamily(Environment* ev,
- ODPart* part);
- void ODSetPOIconFamily(Environment* ev,
- ODPart* part, ODIconFamily iconFamily,
- ODBoolean deleteOtherPlatformIcons =kODTrue);
-
- ODULong ODGetPOSize(Environment* ev,
- ODPersistentObject* pstobj);
- ODID ODGetPOID(Environment* ev,
- ODPersistentObject* pstobj);
-
- // Note: the next two functions are lowlevel functions for directly setting
- // and getting the name property of persistent objects.
- // If you are dealing with a part, please use ODGetPartName & ODSetPartName
- // in order to make sure the right thing happens with respect to
- // the document file, titles of windows etc. -Tantek
- ODIText* ODGetPOName(Environment* ev,
- ODPersistentObject* pstobj,ODIText* name);
- void ODSetPOName(Environment* ev,
- ODPersistentObject* pstobj,ODIText* name);
-
- // The next function is used when the persistent object is not internalized yet. - Vincent
- void ODSetPONameUsingSU(Environment* ev, ODStorageUnit* su, ODIText* name);
-
- //-------------------------------------------------------------------------------------
- // Part only Property getters and setters
- //-------------------------------------------------------------------------------------
-
- ODIText* ODGetPartName(Environment* ev,
- ODFrame* frame,ODIText* name);
- // Returns the name of the part of the frame passed in.
-
- ODBoolean ODSetPartName(Environment* ev,
- ODFrame* frame, ODIText* name, DescType replaceOption);
- // Renames the part of the frame passed in.
- // Returns whether or not it succeeded.
- // The frame helps more easily determine whether
- // the part is the root part of the document or not.
- // For example, renaming the root part of the document could fail
- // if there was a file with the same name and the user canceled the
- // "Replace?" dialog.
-
- void ODRenamePartWindows( Environment *ev, ODSession *session, ODPart *part,
- ODIText *oldName, ODIText *name );
- // Renames windows with 'part' as their root part. Subroutine used
- // by ODSetPartName; not usually needed for other purposes (although
- // the Shell does use it.)
-
-
- ODIText* ODGetComments(Environment* ev, ODFrame* frame, ODIText* comments);
- void ODSetComments(Environment* ev, ODFrame* frame, ODIText* comments);
-
- ODName* ODGetCategory(Environment* ev, ODPart* part, ODNameSpaceManager* nsm);
- ODName* ODGetCatFromPartSU(Environment* ev, ODStorageUnit* su, ODNameSpaceManager* nsm);
- ODName* ODGetCatFromKind(Environment* ev, ODType kind, ODNameSpaceManager* nsm);
-
- ODType ODGetKind(Environment* ev, ODPart* part);
- ODType ODGetKindFromPartSU(Environment* ev, ODStorageUnit* su);
- ODPlatformType ODGetIconFilePlatformTypeFromPartSU(Environment* ev,
- ODStorageUnit* su);
- ODPlatformType ODGetIconFilePlatformCreator( Environment *ev, ODPart *part );
- ODPlatformType ODGetIconFilePlatformCreatorFromPartSU( Environment *ev, ODStorageUnit *su );
-
-
- ODIconFamily ODGetIconFamily(Environment* ev,
- ODFrame* frame);
- void ODSetIconFamily(Environment* ev,
- ODFrame* frame, ODIconFamily iconFamily,
- ODBoolean deleteOtherPlatformIcons =kODTrue);
-
- ODBoolean ODGetIsStationery(Environment* ev,
- ODFrame* frame);
- void ODSetIsStationery(Environment* ev,
- ODFrame* frame, ODBoolean isStationery);
-
- //ODBoolean ODGetSUIsStationery(Environment* ev, ODStorageUnit* su);
- //void ODSetSUIsStationery(Environment* ev,
- // ODStorageUnit* su, ODBoolean isStationery);
-
- //-------------------------------------------------------------------------------------
- // Frame only Property getters and setters
- //-------------------------------------------------------------------------------------
- // see Frame.idl
-
-
- //-------------------------------------------------------------------------------------
- // General Utility functions
- //-------------------------------------------------------------------------------------
-
- void SetAllWindowShowLinks(Environment* ev, ODWindowState* winState, ODBoolean showLinks);
- PlatformFile* ODGetFileIfRoot(Environment* ev, ODFrame* frame);
-
- ODBoolean ODAskUserReplace(Environment* ev,
- ODSession* session);
- // Pass in the name in question via ParamText(^0).
-
- //-------------------------------------------------------------------------------------
- // Editor and Kind popup Menu manipulation functions
- // copied from LinkDlgs.cpp (!with changes by TÇ and CG)
- //-------------------------------------------------------------------------------------
- // private by convention.
-
- void InitKindsPopup ( ODTypeList* kindList,
- ODType theKind,
- ControlHandle itemHandle,
- ODSShort valueCount,
- ODSShort* currentKindItem,
- MenuHandle kindMenu,
- ODSShort* translateItem,
- ODSession* session,
- ODStorageUnit* thePartSU = kODNULL);
- void AddTypesToMenu(ODTypeList* kindList,
- MenuHandle kindMenu,
- ODType defaultKind,
- ODSShort valueCount,
- ODSShort* currentKindItem,
- ODSession* session,
- ODStorageUnit* thePartSU = kODNULL);
- ODUShort EnableTypesInMenu(ODTypeList* typeList,
- MenuHandle kindMenu,
- ODEditor editor,
- ODNameSpaceManager* nsm);
- ODBoolean SetupEditorMenu(ODType kind,
- EditorSet* editorList,
- MenuHandle editorMenu,
- ControlHandle popupCtlHndl,
- ODSession* session,
- ODStorageUnit* thePartSU = kODNULL);
- void AddEditorsToMenu(EditorSet* editorList,
- MenuHandle editorMenu,
- ODSession* session,
- ODStorageUnit* thePartSU = kODNULL);
- void ContentValueTypes(ODStorageUnit* contentSU, ODTypeList* typeList);
- ODEditor GetThisEditorFromList(ODSShort editorIndex, EditorSet* editorList);
- ODType GetThisKindFromList(ODSShort kindItem, ODTypeList* kindList);
- ODSShort IndexOfEditorInList(EditorSet* editorsList, ODEditor editor);
- ODSShort IndexOfKindInList(ODTypeList* kindList, ODType kind);
- void TranslateValueTypes(ODTypeList* kindList,
- ODTypeList* translateToList,
- OrderedCollection* translateFromList,
- ODSession* session);
- void AddTranslationKindToMenu(ODType kind,
- MenuHandle kindMenu,
- short item,
- ODBoolean insert,
- ODSession* session);
- ODType GetTypeListItem(ODTypeList* typeList, ODUShort index);
-
- ODIconFamily ODGetIconSuiteFromDesktopDB(ODPlatformType fileType,ODPlatformType fileCreator);
- ODIconFamily BuildIconSuiteFromDesktop(short DTRefNum,ODPlatformType fileType,ODPlatformType fileCreator);
- ODError ODSetPartNameReturnError(Environment* ev, ODFrame* frame, ODIText* name, DescType replaceOption);
- } // End of extern "C" {
-
- //==============================================================================
- // StVolumeLoop
- //==============================================================================
-
- class StVolumeLoop
- {
- public:
- //——————————————————————————————————————————————————————————————————————
- // Construction and destruction
- //——————————————————————————————————————————————————————————————————————
- StVolumeLoop();
- // Use the system volume for the initial pass
-
- StVolumeLoop(short inInitialVolumeRef);
-
- //——————————————————————————————————————————————————————————————————————
- // Iteration
- //——————————————————————————————————————————————————————————————————————
- Boolean NextVolume(short& outVolume);
-
- //——————————————————————————————————————————————————————————————————————
- // Volume passes
- //——————————————————————————————————————————————————————————————————————
- enum EPass { kInitialPass, kLocalPass, kRemotePass, kDonePass };
-
- EPass GetCurrentVolumePass();
-
- private:
- //——————————————————————————————————————————————————————————————————————
- // Utility functions
- //——————————————————————————————————————————————————————————————————————
- void SetupNextVolumePass();
-
- static Boolean IsRemoteVolume(HParamBlockRec& inHFSParams);
-
- private:
- //——————————————————————————————————————————————————————————————————————
- // Data members
- //——————————————————————————————————————————————————————————————————————
- short mInitialVRefNum;
- EPass mVolumePass;
- short mVolumeIndex;
- };
-
- //==============================================================================
- // StVolumeLoop inlines
- //==============================================================================
-
- //——————————————————————————————————————————————————————————————————————————————
- // StVolumeLoop::GetCurrentVolumePass
- //——————————————————————————————————————————————————————————————————————————————
- inline StVolumeLoop::EPass
- StVolumeLoop::GetCurrentVolumePass()
- {
- return mVolumePass;
- }
-
- //——————————————————————————————————————————————————————————————————————————————
-
- #ifdef _OD_IMPL_SHARE_UTILS_
- #pragma import off
- #elif defined(PRAGMA_INTERNAL_SUPPORTED)
- #pragma internal reset
- #endif
-
- #endif // _INFOUTIL_
-